home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / demos.idb / usr / demos / General_Demos / boink / RUN.z / RUN
Encoding:
Text File  |  1997-06-26  |  5.7 KB  |  162 lines

  1. #!/bin/sh
  2. #Tag 0x9085
  3.  
  4. #**************************************************************************
  5. #*                                                      *
  6. #*          Copyright (c) 1996 Silicon Graphics, Inc.               *
  7. #*                  All Rights Reserved                         *
  8. #*                                                      *
  9. #*       THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI           *
  10. #*                                                      *
  11. #* The copyright notice above does not evidence any actual of intended    *
  12. #* publication of such source code, and is an unpublished work by Silicon *
  13. #* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
  14. #* the property of Silicon Graphics, Inc. Any use, duplication or       *
  15. #* disclosure not specifically authorized by Silicon Graphics is strictly *
  16. #* prohibited.                                              *
  17. #*                                                      *
  18. #* RESTRICTED RIGHTS LEGEND:                                    *
  19. #*                                                      *
  20. #* Use, duplication or disclosure by the Government is subject to       *
  21. #* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in   *
  22. #* Technical Data and Computer Software clause at DFARS 52.227-7013,      *
  23. #* and/or in similar or successor clauses in the FAR, DOD or NASA FAR     *
  24. #* Supplement. Unpublished - rights reserved under the Copyright Laws of  *
  25. #* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.       *
  26. #* Shoreline Blvd., Mountain View, CA 94039-7311                    *
  27. #**************************************************************************
  28.  
  29. # Where do we want to go
  30. URL="file:/usr/demos/General_Demos/boink/data/intro.html"
  31.  
  32. #
  33. # Default place to start up Netscape at,
  34. # currently assuming a 1280x1024 display
  35. #
  36. #GEOMETRY should be of the form "1250x970+15+0"
  37. GEOMETRY="1250x970+15+0"
  38.  
  39. DISPLAY="localhost:0.0"; export DISPLAY
  40. NETSCAPE_3PREF="/usr/demos/Demo_Interfaces/Web/common/preferences"
  41. NETSCAPE_4PREF="/usr/demos/Demo_Interfaces/Web/common/preferences.js"
  42. NETSCAPE_4XDEFAULTS="/usr/demos/Demo_Interfaces/Web/common/Xdefaults"
  43.  
  44. remove_lock() {
  45.    if [ -l $HOME/.netscape/lock ]
  46.    then
  47.       rm $HOME/.netscape/lock
  48.    fi
  49. }
  50.  
  51. launch_ns4() {
  52.    remove_lock
  53.    #
  54.    # netscape4 currently (beta) does not take -geometry or -xrm don't use it.
  55.    #
  56.    # netscape4 will respect an xrdb info with absolute
  57.    # positioning, so get the old value, use desired value and return
  58.    # xrdb to either default or previous setting.
  59.    #
  60.    XRDBNSG=`xrdb -q | fgrep -i netscape | fgrep -i geometry`
  61.    echo "Netscape.Navigator.geometry: =$GEOMETRY" | xrdb -override 
  62.    /usr/bin/X11/netscape $URL &
  63.    sleep 20  # Time so netscape can start up
  64.    if [ -z "$XRDBNSG" ]
  65.    then
  66.       if [ "$USER" = "demos" ]
  67.       then
  68.          # demos default Netscape geometry is 720x887
  69.          echo "Netscape.Navigator.geometry: =835x942" | xrdb -override
  70.       else 
  71.          # Netsape's default geometry is 720x887
  72.          echo "Netscape.Navigator.geometry: =720x887" | xrdb -override
  73.       fi
  74.    else
  75.       echo $XRDBNSG |xrdb -override
  76.    fi
  77.       
  78. }
  79.  
  80. launch_ns3() {
  81.    remove_lock
  82.    #
  83.    # since .Xdefaults overrides Netscape's -geometry option
  84.    # we have to use -xrm which overrides .Xdefaults, the demos account provides
  85.    # an Xdefaults file so that Netscape is a little larger than normal.
  86.    # Some users may have specified Netscape geometry in their Xdefaults file.
  87.    # So do the right thing and specify what we want
  88.    #
  89.    /usr/bin/X11/netscape -xrm "Netscape.Navigator.geometry: $GEOMETRY" $URL &
  90. }
  91.  
  92. # Assuming Navigator is 3.X and Communicator is 4.X
  93. NSVERSION=`showprods -D1 netscape netscape_gold |egrep "Navigator|Communicator"`
  94.  
  95. case "$NSVERSION" in
  96.  
  97.    *Communicator*)
  98.        # If USER null, assume script is being run from the Web Interface
  99.        # under the USER name as nobody. So we need to set up a fake home
  100.        # directory, else run netscape4
  101.        if [ -z "$USER" ]
  102.        then
  103.           HOME="/tmp/nobodyNetscapeHome" ; export HOME
  104.           if [ ! -d $HOME ]
  105.           then
  106.              mkdir -p $HOME/.netscape/cache $HOME/.netscape/archive
  107.              # the preferences file has browser width and height which
  108.              # netscape 4 will respect, but no way for absolute positioning
  109.              # in the preferences
  110.              if [ -f $NETSCAPE_4PREF ]
  111.              then
  112.                 cp $NETSCAPE_4PREF $HOME/.netscape
  113.              fi
  114.          launch_ns4
  115.  
  116.           # If $HOME is set up check to see if it has the old preferences file and replace it
  117.           else
  118.              if [ -f $HOME/.netscape/preferences ]
  119.          then
  120.                 rm $HOME/.netscape/preferences
  121.              fi
  122.              if [ ! -f $HOME/.netscape/preferences.js ]
  123.          then
  124.                 if [ -f $NETSCAPE_4PREF ]
  125.                 then
  126.                    cp $NETSCAPE_4PREF $HOME/.netscape
  127.                 fi
  128.              fi
  129.          launch_ns4
  130.           fi
  131.        else
  132.       launch_ns4
  133.        fi
  134.        ;;
  135.  
  136.    # If not Communicator then at least try Netscape with Navigator's environment
  137.    *Navigator*|*)
  138.        # If USER null, assume script is being run from the Web Interface
  139.        # under the USER name as nobody. So we need to set up a fake home
  140.        # directory. 
  141.        if [ -z "$USER" ]
  142.        then
  143.           HOME="/tmp/nobodyNetscapeHome" ; export HOME
  144.           if [ ! -d $HOME ]
  145.           then
  146.              mkdir -p $HOME/.netscape/cache
  147.              if [ -f $NETSCAPE_3PREF ]
  148.              then
  149.                 cp $NETSCAPE_3PREF $HOME/.netscape
  150.              fi
  151.           fi
  152.           launch_ns3
  153.  
  154.        # If USER is set then assume this script was run from the desktop
  155.        # Either demos or another user
  156.        else
  157.           launch_ns3
  158.        fi
  159.        ;;
  160.  
  161. esac
  162.